package com.maidada.codesharebackend.exception;

/**
 * 全局错误码枚举
 *
 * @author wulinxuan
 * @date 2025-06-24 11:54
 */
public enum GlobalErrorCode implements ErrorCode {

    /**
     * 枚举
     */
    SUCCESS(200, "ok"),
    PARAMS_ERROR(40000, "请求参数错误"),
    NOT_LOGIN_ERROR(40100, "未登录"),
    NO_AUTH_ERROR(40101, "无权限"),
    FORBIDDEN_ERROR(40300, "禁止访问"),
    NOT_FOUND_ERROR(40400, "请求数据不存在"),
    DATA_NOT_FOUND_ERROR(40401, "数据不存在"),
    METHOD_NOT_ALLOWED_ERROR(40500, "请求方法不正确"),
    TIMEOUT_ERROR(40800, "请求超时"),
    DATA_ALREADY_EXISTS_ERROR(40900, "数据已存在"),
    CONFLICT_ERROR(40901, "请求冲突"),
    SYSTEM_ERROR(50000, "系统内部异常"),
    OPERATION_ERROR(50001, "操作失败"),
    ;

    /**
     * 错误码code
     */
    private final int code;

    /**
     * 错误码消息
     */
    private final String message;

    GlobalErrorCode(int code, String message) {
        this.code = code;
        this.message = message;
    }

    @Override
    public int getCode() {
        return code;
    }

    @Override
    public String getMessage() {
        return message;
    }
}
